
var HelloWorld = {
  onLoad: function() {
    // initialization code
    this.initialized = true;
  },

  onMenuItemCommand: function() {
    window.open("chrome://helloworld/content/hello.xul", "", "chrome");
  }
};

function getBrowserWindow() {
 var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].
 getService(Components.interfaces.nsIWindowMediator );
 return wm.getMostRecentWindow("navigator:browser").content.document;
}

function buttonPressed(event)
{
  alert('Button was pressed!');
}

var button = document.getElementById("okbutton");
button.addEventListener('command', buttonPressed, true);

//window.addEventListener("load", function(e) { HelloWorld.onLoad(e); }, false); 
//window.addEventListener("load", function(e) { var text = getBrowserWindow(); alert(Text); }, false);
